<?php

require_once('../includes/SmartyManager.class.php');
require_once('../includes/DB.class.php');
require_once('../includes/Verifier.class.php');

$id=$_GET['id'];

$smarty = SmartyManager::getSmarty();
$assignList = array();
try{

if($_GET['type'] == 'main'){
	$query = "select *
		from little_main where id = $id";
	DB::query($query);
	
	$result = DB::getResult();
	$row = $result->fetch_assoc();
	$assignList = array(
		'id' => $id,
		'certificationNumber' 	=> 	$row['certificationNumber'],
		'facheNumber'	=> $row['facheNumber'],
		'certificationCodification' 		=> 	$row['certificationCodification'],
		'sequenceNumber' 		=> 	$row['sequenceNumber'],
		'manufactory' 		=> 	$row['manufactory'],
		'authenticationMark' 		=> 	$row['authenticationMark'],
		'steelNumber' 		=> 	$row['steelNumber'],
		'size1' 		=> 	$row['size1'],
		'size2' 		=> 	$row['size2'],
		'size3' 		=> 	$row['size3'],
		'count'	=>	$row['count'],
		'unitWeight'		=>	$row['unitWeight'],
		'orderNumber'		=>	$row['orderNumber'],
		'orderSubitemNumber'		=>	$row['orderSubitemNumber'],
		'unitPrice'		=>	$row['unitPrice'],
		'materialNumber'		=>  $row['materialNumber'],
		'consignmentBatch'	=>  $row['consignmentBatch'],
		'sampleBatch'		=>  $row['sampleBatch'],
		'facheNumber'	=>  $row['facheNumber'],
		'purchaseNumber'	=>  $row['purchaseNumber'],
		'shipmentDate'	=>  $row['shipmentDate'],
		'month'	=>  $row['month'],
		'vehicleNumber'	=>  $row['vehicleNumber'],
		'consignee'	=>  $row['consignee'],
		'remark'	=>  $row['remark']
	);
}else if($_GET['type'] == 'ruku'){
	$query = "select *
		from little_ruku where id = $id";
	DB::query($query);
	
	$result = DB::getResult();
	$row = $result->fetch_assoc();
	$assignList = array(
		'id' => $id,
		'rukuDate' => $row['rukuDate'],
		'certificationNumber' => $row['certificationNumber'],
		'certificationCodification' => $row['certificationCodification'],
		'consignmentBatch' => $row['consignmentBatch'],
		'remark1' => $row['remark1'],
		'remark2' => $row['remark2']
	);
}else if($_GET['type'] == 'chuku'){
	$query = "select *
		from little_chuku where id = $id";
	DB::query($query);
	
	$result = DB::getResult();
	$row = $result->fetch_assoc();
	$assignList = array(
		'id' => $id,
		'chukuDate' => $row['chukuDate'],
		'certificationNumber' => $row['certificationNumber'],
		'certificationCodification' => $row['certificationCodification'],
		'consignmentBatch' => $row['consignmentBatch'],
		'handler' => $row['handler'],
		'remark1' => $row['remark1'],
		'remark2' => $row['remark2']
	);
}


}catch(Exception $e){
	$smarty->assign('errMsg', $e);
	$smarty->assign('errTitle', '查询数据库时出现错误');
	$smarty->display('error.html');
	die();
}


$smarty->assign($assignList);
$smarty->assign('type', $_GET['type']);
$smarty->assign('id', $_GET['id']);
$smarty->assign($_GET['type'], true);
$smarty->display('rowEdit.html');
?>